using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class SubtitleController:MonoBehaviour {
	public static SubtitleController instance;
	Text subtitleText;
	float startTime;

	private void Awake() {
		instance=this;
		subtitleText=GetComponent<Text>();
	}
	private void OnDestroy() {
		instance=null;
	}

	private void Update() {
		if(Time.time>startTime+3f) subtitleText.text="";
	}

	public void PushSubtitle(string text) {
		subtitleText.text=text;
		startTime=Time.time;
	}


}
